//
//  LoginViewController.m
//  UI_02 HomeWork
//
//  Created by 402030900@qq.com on 16/7/15.
//  Copyright © 2016年 402030900@qq.com. All rights reserved.
//

#import "LoginViewController.h"
#import "ViewController.h"
#import "TestingViewController.h"
@interface LoginViewController ()

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    // 背景
    UIImageView *imageBack = [[UIImageView alloc] initWithFrame:self.view.frame];
    imageBack.image = [UIImage imageNamed:@"welcome_2.jpg"];
    [self.view addSubview:imageBack];
    imageBack.alpha = 0.7;
    // 拉钩图标
    UIImageView *lagouImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 150)];
    lagouImage.center = CGPointMake(375 / 2 , 220);
    lagouImage.backgroundColor = [UIColor clearColor];
    [self.view addSubview:lagouImage];
    lagouImage.image = [UIImage imageNamed:@"logo_lagou"];
    //圆角
    UIView *corner = [[UIView alloc] initWithFrame:CGRectMake(10, 320 , 315 + 40, 85)];
    corner.backgroundColor = [UIColor clearColor];
    [self.view addSubview:corner];
    corner.layer.cornerRadius = 5;
    corner.clipsToBounds = YES;
    
    // 请输入已验证信息
    //图标
    UIImageView *teleImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    teleImage.backgroundColor = [UIColor blackColor];
    [corner addSubview:teleImage];
    teleImage.alpha = 0.7;
    teleImage.image = [UIImage imageNamed:@"icon_username"];
    //文本框
    UITextField *teleText = [[UITextField alloc] initWithFrame:CGRectMake(40, 0, 375 - 60, 40)];
    teleText.backgroundColor = [UIColor blackColor];
    [corner addSubview:teleText];
    teleText.alpha = 0.4;
    teleText.placeholder = @"请输入已验证手机号或邮箱";// 为嘛不显示
    
    // 验证码
    // 图标
    UIImageView *passImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 45, 40, 40)];
    passImage.backgroundColor = [UIColor blackColor];
    [corner addSubview:passImage];
    passImage.alpha = 0.7;
    passImage.image = [UIImage imageNamed:@"icon_password"];
    // 文本框
    UITextField *passText = [[UITextField alloc] initWithFrame:CGRectMake(40, 45, 375 - 60, 40)];
    passText.backgroundColor = [UIColor blackColor];
    [corner addSubview:passText];
    passText.alpha = 0.4;
    passText.placeholder = @"请输入密码";// 为嘛不显示
    // 忘记密码
    // 图标
    UIImageView *qustionImage = [[UIImageView alloc] initWithFrame:CGRectMake(250, 425, 20, 20)];
    qustionImage.backgroundColor = [UIColor clearColor];
    [self.view addSubview:qustionImage];
    qustionImage.image = [UIImage imageNamed:@"qustion"];
    //忘记密码按钮
    UIButton *forgetPass = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [forgetPass setFrame:CGRectMake(270, 420, 95, 30)];
    forgetPass.backgroundColor = [UIColor clearColor];
    [self.view addSubview:forgetPass];
    [forgetPass setTitle:@"忘记密码" forState:(UIControlStateNormal)];
    [forgetPass addTarget:self action:@selector(didForgetPass:) forControlEvents:(UIControlEventTouchUpInside)];
    [forgetPass setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    
    
    // 登录
    UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeSystem];
    loginButton.frame = CGRectMake(10, 472, 375 - 20, 40);
    [loginButton setTitle:@"登录" forState:UIControlStateNormal];
    [self.view addSubview:loginButton];
    loginButton.backgroundColor = [UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:1];
    [loginButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    loginButton.titleLabel.font = [UIFont boldSystemFontOfSize:20]; //加粗
    [loginButton addTarget:self action:@selector(didBackLogin:) forControlEvents:(UIControlEventTouchUpInside)];
    
    // 注册拉钩
    UIButton *registerButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [registerButton setFrame:CGRectMake(10, 422 + 60 + 50, 375 - 20, 40)];
    [registerButton setTitle:@"注册拉钩" forState:UIControlStateNormal];
    [self.view addSubview:registerButton];
    registerButton.backgroundColor = [UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:0.2];
    [registerButton setTitleColor:[UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    registerButton.layer.borderWidth = 3;
    registerButton.layer.borderColor = [UIColor colorWithRed:64 / 255.0 green:169 / 255.0 blue:116 / 255.0 alpha:1].CGColor;
    registerButton.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [registerButton addTarget:self action:@selector(didRegister:) forControlEvents:(UIControlEventTouchUpInside)];
    // Do any additional setup after loading the view.
}
-(void)didForgetPass:(UIButton *)button {
    TestingViewController * testVC = [[TestingViewController alloc]init];
    [self presentViewController:testVC animated:YES completion:nil];
}
// 注册按钮方法
-(void)didRegister:(UIButton *)button {
    [self dismissViewControllerAnimated:YES completion:nil];
}
// 返回登录按钮方法
-(void)didBackLogin:(UIButton *)button {
    NSLog(@"登陆成功");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
